﻿using System;
using Plugins;
using Plugins.UserControls;
using Utils;

namespace FullDayStrategyPlugin.Common
{
    [Serializable]
	internal class EngineSettingsBase : Plugins.Base.EngineSettingsBase, ICopyable<EngineSettingsBase>, ICloneable<EngineSettingsBase>
    {
		#region Attributes

    	protected readonly StrategyControlData _customOptions;

		#endregion

		#region Properties

		public bool InvertLogic
		{
			get { return _customOptions.InvertLogic; }
			set { _customOptions.InvertLogic = value; }
		}

		public ExecutionDirection ExecutionDirection
		{
			get { return _customOptions.ExecutionDirection; }
			set { _customOptions.ExecutionDirection = value; }
		}

		public bool MultipleOperations
		{
			get { return _customOptions.MultipleOperations; }
			set { _customOptions.MultipleOperations = value; }
		}

		public decimal ResetThreshold
		{
			get { return _customOptions.ResetThreshold; }
			set { _customOptions.ResetThreshold = value; }
		}

		public decimal StopLoss
		{
			get { return _customOptions.StopLoss; }
			set { _customOptions.StopLoss = value; }
		}

		public bool StopLossAt0
		{
			get { return _customOptions.StopLossAt0; }
			set { _customOptions.StopLossAt0 = value; }
		}

		public int VolumeIncrement
		{
			get { return _customOptions.VolumeIncrement; }
			set { _customOptions.VolumeIncrement = value; }
		}

		public VolumeMode VolumeMode
		{
			get { return _customOptions.VolumeMode; }
			set { _customOptions.VolumeMode = value; }
		}

		public bool DynamicStop
		{
			get { return _customOptions.DynamicStop; }
			set { _customOptions.DynamicStop = value; }
		}

		public int QuantityToBuy
		{
			get { return _customOptions.QuantityToBuy; }
			set { _customOptions.QuantityToBuy = value; }
		}

		public int MaxVolume
		{
			get { return _customOptions.MaxVolume; }
			set { _customOptions.MaxVolume = value; }
		}

		public decimal MaxProfit
		{
			get { return _customOptions.MaxProfit; }
			set { _customOptions.MaxProfit = value; }
		}

		public decimal MaxInverseValue
		{
			get { return _customOptions.MaxInverseValue; }
			set { _customOptions.MaxInverseValue = value; }
		}

		#endregion

		#region Public Methods

		public EngineSettingsBase(StrategyControlData customOptions, HourSelectorData hourOptions, StockSelectorData stockSelectionOptions, StockParametersSelectorData stockParameters) : base(hourOptions, stockSelectionOptions, stockParameters)
		{
			_customOptions = customOptions;
		}

		#endregion

		#region ICopyable

		public void Copy(EngineSettingsBase source)
		{
			_customOptions.Copy(source._customOptions);
			base.Copy(source);
		}

		#endregion

		#region ICloneable

		public new EngineSettingsBase Clone()
		{
			return new EngineSettingsBase(_customOptions.Clone(), _hourOptions.Clone(), _stockSelectionOptions.Clone(), _stockParameters.Clone());
		}

		#endregion
	}
}

